<template>
  <!-- 分部分项树搜索 -->
  <tree-search
    v-bind="$attrs"
    v-on="$listeners"
    ref="treeSearch"
    :init-expand-all="false"
    emptyDescription="暂无分部分项信息"
    :api="apiTree"
    isAll
    :selectedKeys.sync="selectedKeys"
    :selectOptions.sync="selectOptions"
  />
</template>

<script>
import TreeSearch from '@/components/businessComponents/TreeSearch' // 树
import { subItem } from '@/api/quality/currency' // api

export default {
  components: {
    TreeSearch,
  },
  computed: {
    // 树节点api
    apiTree() {
      return subItem
    },
  },
  data() {
    return {
      selectedKeys: {},
      selectOptions: {},
    }
  },
  methods: {
    // 渲染列表
    getList() {
      return this.$refs.treeSearch.getList()
    },
  },
  watch: {
    selectedKeys(e) {
      this.$emit('update:selectedKeys', e)
    },
    selectOptions(e) {
      this.$emit('update:selectOptions', e)
    },
  },
}
</script>
